<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link th:replace="fragments/dependency :: list-css">

<title>优铺Admin</title>
</head>

<body class="nav-md">
	<div class="container body">
		<div class="main_container">
			<!-- Left Menu -->
			<div th:replace="fragments/leftMenu :: leftMenu"></div>

			<!-- top navigation -->
			<div th:replace="fragments/header :: header"></div>


			<!-- page content -->
			<div class="right_col" role="main">
				

				<div class="ln_solid"></div>
				<div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                  	<h2>[[${module.name}]]信息</h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                    </ul>
                    <div class="clearfix"></div>
                  </div>
                   <!-- 按钮区域 -->
                  
                  <!-- 搜索区域 -->
                  <div class="x_content">
                  	<div class="form-inline">
		                  <div class="form-group">
		                    <label for="ex3">展示标题：</label>
		                    <input type="text" id="ex3" name="title" th:value="${param.title}" class="form-control" placeholder=" ">
		                    <input type="hidden" id="moduleId" name="moduleId" th:value="${module.id}" >
		                  </div>
                		</div>
                  </div>
                  <div class="x_title">
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                  	<button type="button" class="btn btn-round btn-default" name="returnList" >返回</button>
                    <button type="button" class="btn btn-round btn-primary hide" name="add" permission-rel="/moduleArticle/addPage">新增</button>
                    <button type="button" class="btn btn-round btn-success hide" name="query" permission-rel="/moduleArticle/addPage">查询</button>
                  </div>
                  <div class="x_title">
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                    <div class="table-responsive">
                      <table class="table table-striped jambo_table bulk_action">
                        <thead>
                          <tr class="headings">
                          <th class="column-title">编号 </th>
                          	<th class="column-title">展示封面 </th>
                            <th class="column-title">展示标题 </th>
                            <th class="column-title">所属模块 </th>
                            <th class="column-title">关联文章标题 </th>
                            <th class="column-title">关联文章编号 </th>
                            <th class="column-title">排序 </th>
           
                            <th class="column-title no-link last"><span class="nobr">操作</span>
                            </th>
                          </tr>
                        </thead>
                        <tbody>
                        <tr class="even pointer" th:each="entity : ${pageList}">
							<td th:text="${entity.id}"></td>
							<td><img th:src="${@environment.getProperty('static.domain') + entity.coverUrl}" style="width: 100px;height:100px;" /></td>
							<td th:text="${entity.title}"></td>
							<td th:text="${entity.module?.name}"></td>
							<td th:text="${entity.article?.title}"></td>
							<td th:text="${entity.article?.id}"></td>
							<td th:text="${entity.sort}"></td>
							<td >
								<a href="javascript:;" class="btn btn-primary btn-xs hide"  permission-rel="/moduleArticle/detail" th:onclick="'list.detail(' + ${entity.id} + ')'"><i class="fa fa-folder"></i> 查看 </a>
								<a href="javascript:;" class="btn btn-info btn-xs hide"  permission-rel="/moduleArticle/updatePage" th:onclick="'list.update(' + ${entity.id} + ')'"><i class="fa fa-pencil"></i> 编辑 </a>
								<a href="javascript:;" class="btn btn-danger btn-xs hide"  permission-rel="/moduleArticle/delete" th:onclick="'list.delete(' + ${entity.id} + ')'"><i class="fa fa-trash-o"></i> 删除 </a>
                            </td>
						</tr>
                          
                        </tbody>
                      </table>
                      
                    </div>
                  </div>
                  <div class="x_title">
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                   
                  </div>
                  
                </div>
              </div>
				<div th:replace="fragments/page :: page"></div>

				
			</div>

			<!-- footer content -->
			<footer>
				<div class="pull-right">
					Powered by YouPu team<a target="_blank"
						href="http://www.youpuchina.com"></a>
				</div>
				<div class="clearfix"></div>
			</footer>
			<!-- /footer content -->
		</div>
	</div>

	<div th:replace="fragments/dependency :: list-js"></div>

	<script type="text/javascript">
	var list = {
		baseUrl:"moduleArticle",
		area:['60%','90%'],
		init : function() {
			$('button[name=returnList]').bind('click',list.returnList);
			$('button[name=add]').bind('click',list.add);
			$('button[name=query]').bind('click',function(){
				window.location.href=list.query();
			});
		},
		returnList:function(){
			window.location.href="/communityModule/list";
		},
		detail:function(id){
			adminLayer.ifream({title:'查看',content:'/'+list.baseUrl+'/detail/?id='+id+'&readonly=y',area:list.area});
		},
		add:function(){
			var moduleId = $("input[name=moduleId]").val();
			adminLayer.ifream({title:'新增',content:'/'+list.baseUrl+'/addPage/?moduleId='+moduleId,area:list.area});
		},
		update:function(id){
			adminLayer.ifream({title:'编辑',content:'/'+list.baseUrl+'/updatePage/?id='+id+'&readonly=n',area:list.area});
		},
		delete:function(id){
			adminLayer.confirm({title:'警告',content:'确定删除吗？',yes:function(){
				httpClientForUpAdmin.del('/'+list.baseUrl+'/delete/?id='+id,null,function(data){
					if(data.Type==200){
						adminLayer.alert({content:'删除成功',yes:function(){
							location.reload();
						}});
					}
				});
			}});
			
		},
		query : function() {
			pageFoot.searchUrl = '/'+list.baseUrl+'/list';
			var name = $("input[name=name]").val();
			var moduleId = $("input[name=moduleId]").val();
			return pageFoot.addParam("name", name).searchUrl;
		}
	}
	pageFoot.getCurrentUrl = function() {
		return list.query();
	}
	pageFoot.init();
	list.init();
</script>
</body>
</html>
